package com.example.freshmenclient.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.freshmenclient.R;
import com.example.freshmenclient.bean.ClassMateBean;

import java.util.List;

public class ClassMateAdapter extends BaseAdapter {

    private Context context;
    private List<ClassMateBean.DataBean> data;

    public ClassMateAdapter(Context context, List<ClassMateBean.DataBean> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = View.inflate(context, R.layout.item_classmate, null);

        TextView tvName = convertView.findViewById(R.id.tv_classmat_name);
        tvName.setText(data.get(position).getName());

        return convertView;
    }
}
